package com.machine.bootstatemachine.enums;

import lombok.Getter;

/**
 * @Author dai
 * @Date 2021/12/26
 */
@Getter
public enum OrderStatueEnum {
    /**
     * 待支付
     */
    UN_PAY(1, "待支付"),
    /**
     * 已支付
     */
    WAITING_FOR_RECEIVE(2, "待收货"),
    /**
     * 收货完成
     */
    DONE(3, "收货完成");
    private Integer status;
    private String desc;

    OrderStatueEnum(Integer status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public static OrderStatueEnum of(Integer status) {
        switch (status) {
            case 1:
                return OrderStatueEnum.UN_PAY;
            case 2:
                return OrderStatueEnum.WAITING_FOR_RECEIVE;
            case 3:
                return OrderStatueEnum.DONE;
            default:
                throw new IllegalArgumentException("未定义的类型，请确认后进行修改。");
        }
    }


}
